# tmux.conf for the anaconda environment

bind -n M-tab next
bind -n F1 list-keys

set-option -s exit-unattached off
set-option -g base-index 1

# tmux 2.4 has different name for this option.
# See https://github.com/rhinstaller/anaconda/pull/1040
# This checks if the current tmux version (from tmux -V) >= 2.4, using
# sort -V to do a version-y comparison (and -r to reverse it)
if-shell '[ $(printf "$(tmux -V | cut -d" " -f2)\n2.4" | sort -Vr | head -n1) == $(tmux -V | cut -d" " -f2) ]' \
    'set-option -g remain-on-exit on' \
    'set-option -g set-remain-on-exit on'

set-option -g history-limit 10000

# The idea here is to detach the client started here via anaconda.service, and
# then re-attach to it in the tmux service run on the console tty.
new-session -d -s anaconda -n main anaconda

set-option status-right '#[fg=blue]#(echo -n "Switch tab: Alt+Tab | Help: F1 ")'

new-window -d -n shell          "bash --login"
new-window -d -n log            "tail -F /tmp/anaconda.log"
new-window -d -n storage-log    "tail -F /tmp/storage.log"
new-window -d -n program-log    "tail -F /tmp/program.log"
new-window -d -n packaging-log  "tail -F /tmp/packaging.log"
